/***
 * @Author: 玄绮 shijiahansi@qq.com
 * @Date: 2024-06-08 09:15:48
 * @LastEditors: 玄绮 shijiahansi@qq.com
 * @LastEditTime: 2024-06-08 09:19:10
 * @FilePath: \server\dep\rdhttp\body\HttpBoundaryBody.h
 * @Description:
 * @
 * @Copyright (c) 2024 by 玄绮, All Rights Reserved.
 */

#include <fields/ContentDisposition.h>
#include <fields/ContentType.h>
#include <filesystem>
#include <string_view>

#if !defined(__FORM_ITEM_H__)
#    define __FORM_ITEM_H__
namespace rdhttp {

    class FormItem {
        using StringView = std::string_view;

    private:
        ContentType m_content_type;
        ContentDisposition m_content_dispotion;
        StringView m_content;

        void pares_head(StringView head);

    public:
        void pares(StringView data);

        // 另存到文件
        bool save_as(std::filesystem::path path) const;

        const ContentType& content_type() const;
        const ContentDisposition& content_dispotion() const;
        StringView content() const;

    public:
        FormItem(std::string_view data);
        ~FormItem();
    };

}  // namespace rdhttp

#endif  // __FORM_ITEM_H__
